package com.lfx.concurrent;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.function.Consumer;

public class CompletTableFutureMain4 {

    public static void main(String[] args) throws ExecutionException, InterruptedException {
        CompletableFuture<Void> stringCompletableFuture1 = CompletableFuture.supplyAsync(() -> {
            try {
                Thread.sleep(5);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            return "返回结果";
        }).thenAccept((String preResut)-> {
            System.out.println(preResut);
        });

        stringCompletableFuture1.get();
        System.out.println("result" );

    }
}
